package com.tian.common.core.page;

import com.tian.common.utils.StringUtils;

/**
 * 分页数据
 *
 * @author zxy
 */
public class PageDomain {
    /**
     * 当前记录起始索引
     */
    private Integer pageNum;
    /**
     * 每页显示记录数
     */
    private Integer pageSize;
    /**
     * 排序列
     */
    private String orderBy;
    /**
     * 排序的方向 "desc" 或者 "asc".
     */
    private String sort;

    public String getOrderBy() {
        if (StringUtils.isEmpty(orderBy)) {
            return "";
        }
        return StringUtils.toUnderScoreCase(orderBy, "_") + " " + sort;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }
}
